/**
 * This file is part of 1genia trampoline
 * Copyright (C) 2007 - 2008 1genia (contact@1genia.com)
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; version 3 of the License. 
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details. 
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; see the file COPYING.TXT.  If not,
 * write to the Free Software Foundation, Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301, USA. 
 **/
/**
 * 
 */
package com.genia.toolbox.projects.csv.business.manager;

import java.io.File;
import java.util.List;

import com.genia.toolbox.basics.exception.BundledException;
import com.genia.toolbox.projects.csv.bean.CsvVersion;
import com.genia.toolbox.projects.csv.bean.MappingDescriptor;

/**
 * front interface manager of csv import process.
 */
public interface CsvImportManager
{

  /**
   * list exsting versions for the given base path.
   * 
   * @param mappingDescriptor
   *          the {@link MappingDescriptor} that describes the mapping
   * @param basePath
   *          the {@link File} representation of the path to the base folder
   * @return a {@link List} of {@link CsvVersion}s
   * @throws BundledException
   *           if an error occur
   */
  public List<CsvVersion> listVersions(MappingDescriptor mappingDescriptor, File basePath)
      throws BundledException;



  /**
   * generate empty csv files with column headers.
   * 
   * @param mappingDescriptor
   *          the {@link MappingDescriptor} that describes the mapping
   * @param basePath
   *          the {@link File} representation of the path to the base folder
   * @return the {@link CsvVersion} of generated files
   * @throws BundledException
   *           if an error occur
   */
  public CsvVersion generateEmptyCsvFiles(MappingDescriptor mappingDescriptor, File basePath)
      throws BundledException;



  /**
   * import csv data for the given version.
   * 
   * @param mappingDescriptor
   *          the {@link MappingDescriptor} that describes the mapping
   * @param basePath
   *          the {@link File} representation of the path to the base folder
   * @param version
   *          the {@link CsvVersion} to consider
   * @throws BundledException
   *           if an error occur
   */
  public void importCsvData(MappingDescriptor mappingDescriptor, File basePath, CsvVersion version)
      throws BundledException;



  /**
   * automatically choose the latest csv version and import data.
   * 
   * @param mappingDescriptor
   *          the {@link MappingDescriptor} that describes the mapping
   * @param basePath
   *          the {@link File} representation of the path to the base folder
   * @throws BundledException
   *           if an error occur
   */
  public void importLastCsvDataVersion(MappingDescriptor mappingDescriptor, File basePath)
      throws BundledException;

}
